import com.lbi.animation.group.Queue;
import com.lbi.animation.group.Set;
import com.lbi.animation.single.Tween;
import com.lbi.core.helper.Delegate;

import animation.queue.QueueTestCase;

/**
 * @author micfor
 */
class animation.queue.QueueWithStackedQueueTest extends QueueTestCase {
	private var className : String = "QueueWithStackedQueueTest";
	private var test_obj : Queue;

	private var first_item_value : Number;
	private var first_tween : Tween;

	private var second_item_value : Number;
	private var second_tween : Tween;

	private var third_item_value : Number;
	private var third_tween : Tween;

	private var fourth_item_value : Number;
	private var fourth_tween : Tween;

	private var FRAMES : Number = 5;
	private var TARGET_VALUE : Number = 1;

	private var nested_queue : Queue;

	private var stack_with_nested_queue : Set;
	

	/**
	 * <pre>
	 *	_________
	 *	>---.          <-- nested		\
	 *	 	 >---.          queue		|
	 *	_________                       | <-- queued_stack
	 *	>-------.      <-- third_tween	|
	 *	_________                       /
	 *	         >-----. <-- fourth_tween
	 *	         ______
	 *	_______________
	 *	   test_obj
	 * 	 	
	 * 	</pre>
	 */
	function run():Void{
		addTweenValuePairs(["first","second","third","fourth"]);
		test_obj = new Queue();
		nested_queue = new Queue();
		nested_queue.addAnimation(first_tween);
		nested_queue.addAnimation(second_tween);
		stack_with_nested_queue = new Set([nested_queue, third_tween]);
		test_obj.addAnimation(stack_with_nested_queue);
		test_obj.addAnimation(fourth_tween);
		test_obj.addEventListener("complete",Delegate.create(this, runNow));
		test_obj.go();
	}
	

	function testQueueWithStackedQueueInIt():Void{
		assertValuesEqualTo(TARGET_VALUE,[first_item_value,second_item_value,third_item_value,fourth_item_value]);
	}	

}